package day_03;

import java.util.Scanner;

/**
 * 声网的笔试
 */
public class SWFirstTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int number = Integer.parseInt(sc.nextLine());

        int ret = handle(number);
        System.out.println(ret);
    }

    private static int handle(int n) {
        if(n <= 0 || n % 2 == 0 || n % 5 == 0 || n >= 10000) return -1;
        if(n == 1) return 1;
        String numStr = "1";
        while(true){
            long num = Long.parseLong(numStr);
            if(num / (n * 1.0) < 1){
                numStr = numStr + "1";
            }else{
                double dev = num / (n * 1.0);
                double y = num % (n * 1.0);
                if(y <= 0.1){
                    System.out.println("余数为："  + y);
                    System.out.println("numStr = " + numStr);
                    System.out.println("除数 = " + dev);
                    return numStr.length();
                }else{
                    numStr = numStr + "1";
                }
            }
        }
    }
}
